package com.sara.web.movie;

import com.sara.entity.Movie;
import com.sara.service.MovieService;
import com.sara.util.Page;
import com.sara.web.BaseServlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/movie/list")
public class ListServlet extends BaseServlet {
    private static final long serialVersionUID = 1L;
    MovieService movieService = new MovieService();


    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String keys = req.getParameter("keys");
        String p = req.getParameter("p");

        Page<Movie> page = movieService.findMovieByPage(p,keys);

        System.out.println("listServlet的keys:" + keys);
        System.out.println("listServlet的page:" + page.toString());

        req.setAttribute("keys", keys);
        req.setAttribute("page",page);
        forword("movie/list",req,resp);
    }


}
